#include "stdio.h"
#include "math.h"



void main()
{
	double  a[4][8];
	double  det,a1,a2,a3;
	int n,i,j,icase;


	scanf("%d",&n);
	for (icase=1;icase<=n;icase++)
	{
		for (i=1;i<=3;i++)
			for (j=1;j<=4;j++)
			{
				scanf("%lf",&a[i][j]);
			}

		det=a[1][1]*(a[2][2]*a[3][3]-a[2][3]*a[3][2])-
			a[1][2]*(a[2][1]*a[3][3]-a[2][3]*a[3][1])+ 
			a[1][3]*(a[2][1]*a[3][2]-a[2][2]*a[3][1]); 

		a1 =a[1][4]*(a[2][2]*a[3][3]-a[2][3]*a[3][2])-
			a[1][2]*(a[2][4]*a[3][3]-a[2][3]*a[3][4])+ 
			a[1][3]*(a[2][4]*a[3][2]-a[2][2]*a[3][4]); 

		a2 =a[1][1]*(a[2][4]*a[3][3]-a[2][3]*a[3][4])-
			a[1][4]*(a[2][1]*a[3][3]-a[2][3]*a[3][1])+ 
			a[1][3]*(a[2][1]*a[3][4]-a[2][4]*a[3][1]); 
		
		a3 =a[1][1]*(a[2][2]*a[3][4]-a[2][4]*a[3][2])-
			a[1][2]*(a[2][1]*a[3][4]-a[2][4]*a[3][1])+ 
			a[1][4]*(a[2][1]*a[3][2]-a[2][2]*a[3][1]); 
		
		printf("%.0lf %.0lf %.0lf %.0lf\n",a1,a2,a3,det);		
		
		if (det==0) 
		{
			printf("No unique solution\n");
		}
		else
		{
			printf("Unique solution: %.3lf %.3lf %.3lf\n",a1*1.0/det+1e-6,a2*1.0/det+1e-6,a3*1.0/det+1e-6);
		}
		printf("\n");

	}
}